package com.frxuexi.shop2307.adapter

import androidx.databinding.DataBindingUtil
import androidx.recyclerview.widget.GridLayoutManager
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.frxuexi.lib_base.entity.ShopCommentItemBean
import com.frxuexi.shop2307.R
import com.frxuexi.shop2307.databinding.ItemCommentBinding

class CommentAdapter:BaseQuickAdapter<ShopCommentItemBean,BaseViewHolder>(R.layout.item_comment) {

    override fun onItemViewHolderCreated(viewHolder: BaseViewHolder, viewType: Int) {
        super.onItemViewHolderCreated(viewHolder, viewType)
        DataBindingUtil.bind<ItemCommentBinding>(viewHolder.itemView)
    }
    override fun convert(helper: BaseViewHolder, item: ShopCommentItemBean) {
        val binding = DataBindingUtil.getBinding<ItemCommentBinding>(helper.itemView)!!
        binding.bean=item

        val commentImgAdapter by lazy { CommentImgAdapter() }
        commentImgAdapter.addData(item.pics)
        binding.commRv.apply {

            adapter=commentImgAdapter
            layoutManager=GridLayoutManager(context,3)
        }

    }
}